<html><!-- Created using the cpp_pretty_printer from the dlib C++ library.  See http://dlib.net for updates. --><head><title>dlib C++ Library - hough_transform.h</title></head><body bgcolor='white'><pre>
<font color='#009900'>// Copyright (C) 2014  Davis E. King (davis@dlib.net)
</font><font color='#009900'>// License: Boost Software License   See LICENSE.txt for the full license.
</font><font color='#0000FF'>#ifndef</font> DLIB_HOUGH_tRANSFORM_Hh_
<font color='#0000FF'>#define</font> DLIB_HOUGH_tRANSFORM_Hh_

<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='hough_transform_abstract.h.html'>hough_transform_abstract.h</a>"
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='../image_processing/generic_image.h.html'>../image_processing/generic_image.h</a>"
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='../geometry.h.html'>../geometry.h</a>"
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='../algs.h.html'>../algs.h</a>"
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='assign_image.h.html'>assign_image.h</a>"
<font color='#0000FF'>#include</font> <font color='#5555FF'>&lt;</font>limits<font color='#5555FF'>&gt;</font>

<font color='#0000FF'>namespace</font> dlib
<b>{</b>

<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
    <font color='#0000FF'>class</font> <b><a name='hough_transform'></a>hough_transform</b>
    <b>{</b>

    <font color='#0000FF'>public</font>:
        <font color='#0000FF'>explicit</font> <b><a name='hough_transform'></a>hough_transform</b> <font face='Lucida Console'>(</font>
            <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> size_
        <font face='Lucida Console'>)</font> : _size<font face='Lucida Console'>(</font>size_<font face='Lucida Console'>)</font> 
        <b>{</b>
            <font color='#BB00BB'>DLIB_CASSERT</font><font face='Lucida Console'>(</font>size_ <font color='#5555FF'>&gt;</font> <font color='#979000'>0</font>,
                "<font color='#CC0000'>\t hough_transform::hough_transform(size_)</font>"
                <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>\n\t Invalid arguments given to this function.</font>"
                <font face='Lucida Console'>)</font>;

            even_size <font color='#5555FF'>=</font> _size <font color='#5555FF'>-</font> <font face='Lucida Console'>(</font>_size<font color='#5555FF'>%</font><font color='#979000'>2</font><font face='Lucida Console'>)</font>;

            <font color='#0000FF'>const</font> point cent <font color='#5555FF'>=</font> <font color='#BB00BB'>center</font><font face='Lucida Console'>(</font><font color='#BB00BB'>rectangle</font><font face='Lucida Console'>(</font><font color='#979000'>0</font>,<font color='#979000'>0</font>,size_<font color='#5555FF'>-</font><font color='#979000'>1</font>,size_<font color='#5555FF'>-</font><font color='#979000'>1</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
            xcos_theta.<font color='#BB00BB'>set_size</font><font face='Lucida Console'>(</font>size_, size_<font face='Lucida Console'>)</font>;
            ysin_theta.<font color='#BB00BB'>set_size</font><font face='Lucida Console'>(</font>size_, size_<font face='Lucida Console'>)</font>;

            std::vector<font color='#5555FF'>&lt;</font><font color='#0000FF'><u>double</u></font><font color='#5555FF'>&gt;</font> <font color='#BB00BB'>cos_theta</font><font face='Lucida Console'>(</font>size_<font face='Lucida Console'>)</font>, <font color='#BB00BB'>sin_theta</font><font face='Lucida Console'>(</font>size_<font face='Lucida Console'>)</font>;
            <font color='#0000FF'>const</font> <font color='#0000FF'><u>double</u></font> scale <font color='#5555FF'>=</font> <font color='#979000'>1</font><font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font><font color='#979000'>16</font>;
            <font color='#0000FF'>for</font> <font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> t <font color='#5555FF'>=</font> <font color='#979000'>0</font>; t <font color='#5555FF'>&lt;</font> size_; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>t<font face='Lucida Console'>)</font>
            <b>{</b>
                <font color='#0000FF'><u>double</u></font> theta <font color='#5555FF'>=</font> t<font color='#5555FF'>*</font>pi<font color='#5555FF'>/</font>even_size;

                cos_theta[t] <font color='#5555FF'>=</font> scale<font color='#5555FF'>*</font>std::<font color='#BB00BB'>cos</font><font face='Lucida Console'>(</font>theta<font face='Lucida Console'>)</font><font color='#5555FF'>/</font>sqrt_2;
                sin_theta[t] <font color='#5555FF'>=</font> scale<font color='#5555FF'>*</font>std::<font color='#BB00BB'>sin</font><font face='Lucida Console'>(</font>theta<font face='Lucida Console'>)</font><font color='#5555FF'>/</font>sqrt_2;
            <b>}</b>
            <font color='#0000FF'>const</font> <font color='#0000FF'><u>double</u></font> offset <font color='#5555FF'>=</font> scale<font color='#5555FF'>*</font>even_size<font color='#5555FF'>/</font><font color='#979000'>4.0</font> <font color='#5555FF'>+</font> <font color='#979000'>0.5</font>;

            <font color='#0000FF'>for</font> <font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> c <font color='#5555FF'>=</font> <font color='#979000'>0</font>; c <font color='#5555FF'>&lt;</font> size_; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>c<font face='Lucida Console'>)</font>
            <b>{</b>
                <font color='#0000FF'>const</font> <font color='#0000FF'><u>long</u></font> x <font color='#5555FF'>=</font> c <font color='#5555FF'>-</font> cent.<font color='#BB00BB'>x</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
                <font color='#0000FF'>for</font> <font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> t <font color='#5555FF'>=</font> <font color='#979000'>0</font>; t <font color='#5555FF'>&lt;</font> size_; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>t<font face='Lucida Console'>)</font>
                    <font color='#BB00BB'>xcos_theta</font><font face='Lucida Console'>(</font>c,t<font face='Lucida Console'>)</font> <font color='#5555FF'>=</font> <font color='#0000FF'>static_cast</font><font color='#5555FF'>&lt;</font>int32<font color='#5555FF'>&gt;</font><font face='Lucida Console'>(</font>x<font color='#5555FF'>*</font>cos_theta[t] <font color='#5555FF'>+</font> offset<font face='Lucida Console'>)</font>;
            <b>}</b>
            <font color='#0000FF'>for</font> <font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> r <font color='#5555FF'>=</font> <font color='#979000'>0</font>; r <font color='#5555FF'>&lt;</font> size_; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>r<font face='Lucida Console'>)</font>
            <b>{</b>
                <font color='#0000FF'>const</font> <font color='#0000FF'><u>long</u></font> y <font color='#5555FF'>=</font> r <font color='#5555FF'>-</font> cent.<font color='#BB00BB'>y</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
                <font color='#0000FF'>for</font> <font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> t <font color='#5555FF'>=</font> <font color='#979000'>0</font>; t <font color='#5555FF'>&lt;</font> size_; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>t<font face='Lucida Console'>)</font>
                    <font color='#BB00BB'>ysin_theta</font><font face='Lucida Console'>(</font>r,t<font face='Lucida Console'>)</font> <font color='#5555FF'>=</font> <font color='#0000FF'>static_cast</font><font color='#5555FF'>&lt;</font>int32<font color='#5555FF'>&gt;</font><font face='Lucida Console'>(</font>y<font color='#5555FF'>*</font>sin_theta[t] <font color='#5555FF'>+</font> offset<font face='Lucida Console'>)</font>;
            <b>}</b>
        <b>}</b>

        <font color='#0000FF'>inline</font> <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> <b><a name='size'></a>size</b><font face='Lucida Console'>(</font>
        <font face='Lucida Console'>)</font> <font color='#0000FF'>const</font> <b>{</b> <font color='#0000FF'>return</font> _size; <b>}</b>

        <font color='#0000FF'><u>long</u></font> <b><a name='nr'></a>nr</b><font face='Lucida Console'>(</font>
        <font face='Lucida Console'>)</font> <font color='#0000FF'>const</font> <b>{</b> <font color='#0000FF'>return</font> _size; <b>}</b>

        <font color='#0000FF'><u>long</u></font> <b><a name='nc'></a>nc</b><font face='Lucida Console'>(</font>
        <font face='Lucida Console'>)</font> <font color='#0000FF'>const</font> <b>{</b> <font color='#0000FF'>return</font> _size; <b>}</b>

        std::pair<font color='#5555FF'>&lt;</font>dpoint, dpoint<font color='#5555FF'>&gt;</font> <b><a name='get_line'></a>get_line</b> <font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> dpoint<font color='#5555FF'>&amp;</font> p
        <font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>
        <b>{</b>
            <font color='#BB00BB'>DLIB_ASSERT</font><font face='Lucida Console'>(</font><font color='#BB00BB'>rectangle</font><font face='Lucida Console'>(</font><font color='#979000'>0</font>,<font color='#979000'>0</font>,<font color='#BB00BB'>size</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>-</font><font color='#979000'>1</font>,<font color='#BB00BB'>size</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>-</font><font color='#979000'>1</font><font face='Lucida Console'>)</font>.<font color='#BB00BB'>contains</font><font face='Lucida Console'>(</font>p<font face='Lucida Console'>)</font> <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#979000'>true</font>,
                "<font color='#CC0000'>\t pair&lt;dpoint,dpoint&gt; hough_transform::get_line(dpoint)</font>"
                <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>\n\t Invalid arguments given to this function.</font>"
                <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>\n\t p:      </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> p 
                <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>\n\t size(): </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> <font color='#BB00BB'>size</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>
                <font face='Lucida Console'>)</font>;

            <font color='#009900'>// First we compute the radius measured in pixels from the center and the theta
</font>            <font color='#009900'>// angle in radians.
</font>            <font color='#0000FF'><u>double</u></font> theta, radius;
            <font color='#BB00BB'>get_line_properties</font><font face='Lucida Console'>(</font>p, theta, radius<font face='Lucida Console'>)</font>;
            theta <font color='#5555FF'>*</font><font color='#5555FF'>=</font> pi<font color='#5555FF'>/</font><font color='#979000'>180</font>;

            <font color='#009900'>// now make a line segment on the line.
</font>            <font color='#0000FF'>const</font> rectangle box <font color='#5555FF'>=</font> <font color='#BB00BB'>get_rect</font><font face='Lucida Console'>(</font><font color='#5555FF'>*</font><font color='#0000FF'>this</font><font face='Lucida Console'>)</font>;
            <font color='#0000FF'>const</font> dpoint cent <font color='#5555FF'>=</font> <font color='#BB00BB'>center</font><font face='Lucida Console'>(</font>box<font face='Lucida Console'>)</font>;
            dpoint v1 <font color='#5555FF'>=</font> cent <font color='#5555FF'>+</font> <font color='#BB00BB'>dpoint</font><font face='Lucida Console'>(</font><font color='#BB00BB'>size</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>+</font><font color='#979000'>1000</font>,<font color='#979000'>0</font><font face='Lucida Console'>)</font> <font color='#5555FF'>+</font> <font color='#BB00BB'>dpoint</font><font face='Lucida Console'>(</font><font color='#979000'>0</font>,radius<font face='Lucida Console'>)</font>;
            dpoint v2 <font color='#5555FF'>=</font> cent <font color='#5555FF'>-</font> <font color='#BB00BB'>dpoint</font><font face='Lucida Console'>(</font><font color='#BB00BB'>size</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>+</font><font color='#979000'>1000</font>,<font color='#979000'>0</font><font face='Lucida Console'>)</font> <font color='#5555FF'>+</font> <font color='#BB00BB'>dpoint</font><font face='Lucida Console'>(</font><font color='#979000'>0</font>,radius<font face='Lucida Console'>)</font>;
            dpoint p1 <font color='#5555FF'>=</font> <font color='#BB00BB'>rotate_point</font><font face='Lucida Console'>(</font>cent, v1, theta<font face='Lucida Console'>)</font>;
            dpoint p2 <font color='#5555FF'>=</font> <font color='#BB00BB'>rotate_point</font><font face='Lucida Console'>(</font>cent, v2, theta<font face='Lucida Console'>)</font>;

            <font color='#BB00BB'>clip_line_to_rectangle</font><font face='Lucida Console'>(</font>box, p1, p2<font face='Lucida Console'>)</font>;

            <font color='#0000FF'>return</font> std::<font color='#BB00BB'>make_pair</font><font face='Lucida Console'>(</font>p1,p2<font face='Lucida Console'>)</font>;
        <b>}</b>

        <font color='#0000FF'><u>double</u></font> <b><a name='get_line_angle_in_degrees'></a>get_line_angle_in_degrees</b> <font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> dpoint<font color='#5555FF'>&amp;</font> p 
        <font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>
        <b>{</b>
            <font color='#0000FF'><u>double</u></font> angle, radius;
            <font color='#BB00BB'>get_line_properties</font><font face='Lucida Console'>(</font>p, angle, radius<font face='Lucida Console'>)</font>;
            <font color='#0000FF'>return</font> angle;
        <b>}</b>

        <font color='#0000FF'><u>void</u></font> <b><a name='get_line_properties'></a>get_line_properties</b> <font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> dpoint<font color='#5555FF'>&amp;</font> p,
            <font color='#0000FF'><u>double</u></font><font color='#5555FF'>&amp;</font> angle_in_degrees,
            <font color='#0000FF'><u>double</u></font><font color='#5555FF'>&amp;</font> radius
        <font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>
        <b>{</b>
            <font color='#0000FF'>const</font> dpoint cent <font color='#5555FF'>=</font> <font color='#BB00BB'>center</font><font face='Lucida Console'>(</font><font color='#BB00BB'>get_rect</font><font face='Lucida Console'>(</font><font color='#5555FF'>*</font><font color='#0000FF'>this</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
            <font color='#0000FF'><u>double</u></font> theta <font color='#5555FF'>=</font> p.<font color='#BB00BB'>x</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>-</font>cent.<font color='#BB00BB'>x</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
            radius <font color='#5555FF'>=</font> p.<font color='#BB00BB'>y</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>-</font>cent.<font color='#BB00BB'>y</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
            angle_in_degrees <font color='#5555FF'>=</font> <font color='#979000'>180</font><font color='#5555FF'>*</font>theta<font color='#5555FF'>/</font>even_size;
            radius <font color='#5555FF'>=</font> radius<font color='#5555FF'>*</font>sqrt_2 <font color='#5555FF'>+</font> <font color='#979000'>0.5</font>;
        <b>}</b>

        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
            <font color='#0000FF'>typename</font> image_type
            <font color='#5555FF'>&gt;</font>
        point <b><a name='get_best_hough_point'></a>get_best_hough_point</b> <font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> point<font color='#5555FF'>&amp;</font> p,
            <font color='#0000FF'>const</font> image_type<font color='#5555FF'>&amp;</font> himg_
        <font face='Lucida Console'>)</font>
        <b>{</b>
            <font color='#0000FF'>const</font> const_image_view<font color='#5555FF'>&lt;</font>image_type<font color='#5555FF'>&gt;</font> <font color='#BB00BB'>himg</font><font face='Lucida Console'>(</font>himg_<font face='Lucida Console'>)</font>;

            <font color='#BB00BB'>DLIB_ASSERT</font><font face='Lucida Console'>(</font>himg.<font color='#BB00BB'>nr</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#BB00BB'>size</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> himg.<font color='#BB00BB'>nc</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#BB00BB'>size</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font>
                <font color='#BB00BB'>rectangle</font><font face='Lucida Console'>(</font><font color='#979000'>0</font>,<font color='#979000'>0</font>,<font color='#BB00BB'>size</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>-</font><font color='#979000'>1</font>,<font color='#BB00BB'>size</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>-</font><font color='#979000'>1</font><font face='Lucida Console'>)</font>.<font color='#BB00BB'>contains</font><font face='Lucida Console'>(</font>p<font face='Lucida Console'>)</font> <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#979000'>true</font>,
                "<font color='#CC0000'>\t point hough_transform::get_best_hough_point()</font>"
                <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>\n\t Invalid arguments given to this function.</font>"
                <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>\n\t himg.nr(): </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> himg.<font color='#BB00BB'>nr</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>
                <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>\n\t himg.nc(): </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> himg.<font color='#BB00BB'>nc</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>
                <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>\n\t size():    </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> <font color='#BB00BB'>size</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>
                <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>\n\t p:         </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> p 
                <font face='Lucida Console'>)</font>;


            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> image_traits<font color='#5555FF'>&lt;</font>image_type<font color='#5555FF'>&gt;</font>::pixel_type pixel_type;
            <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font>pixel_traits<font color='#5555FF'>&lt;</font>pixel_type<font color='#5555FF'>&gt;</font>::grayscale <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#979000'>true</font><font face='Lucida Console'>)</font>;
            pixel_type best_val <font color='#5555FF'>=</font> std::numeric_limits<font color='#5555FF'>&lt;</font>pixel_type<font color='#5555FF'>&gt;</font>::<font color='#BB00BB'>min</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
            point best_point;


            <font color='#0000FF'>const</font> <font color='#0000FF'><u>long</u></font> max_n8 <font color='#5555FF'>=</font> <font face='Lucida Console'>(</font>himg.<font color='#BB00BB'>nc</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>/</font><font color='#979000'>8</font><font face='Lucida Console'>)</font><font color='#5555FF'>*</font><font color='#979000'>8</font>;
            <font color='#0000FF'>const</font> <font color='#0000FF'><u>long</u></font> max_n4 <font color='#5555FF'>=</font> <font face='Lucida Console'>(</font>himg.<font color='#BB00BB'>nc</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>/</font><font color='#979000'>4</font><font face='Lucida Console'>)</font><font color='#5555FF'>*</font><font color='#979000'>4</font>;
            <font color='#0000FF'>const</font> <font color='#0000FF'><u>long</u></font> r <font color='#5555FF'>=</font> p.<font color='#BB00BB'>y</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
            <font color='#0000FF'>const</font> <font color='#0000FF'><u>long</u></font> c <font color='#5555FF'>=</font> p.<font color='#BB00BB'>x</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;

            <font color='#0000FF'>const</font> int32<font color='#5555FF'>*</font> ysin <font color='#5555FF'>=</font> <font color='#5555FF'>&amp;</font><font color='#BB00BB'>ysin_theta</font><font face='Lucida Console'>(</font>r,<font color='#979000'>0</font><font face='Lucida Console'>)</font>;
            <font color='#0000FF'>const</font> int32<font color='#5555FF'>*</font> xcos <font color='#5555FF'>=</font> <font color='#5555FF'>&amp;</font><font color='#BB00BB'>xcos_theta</font><font face='Lucida Console'>(</font>c,<font color='#979000'>0</font><font face='Lucida Console'>)</font>;
            <font color='#0000FF'><u>long</u></font> t <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
            <font color='#0000FF'>while</font><font face='Lucida Console'>(</font>t <font color='#5555FF'>&lt;</font> max_n8<font face='Lucida Console'>)</font>
            <b>{</b>
                <font color='#0000FF'><u>long</u></font> rr0 <font color='#5555FF'>=</font> <font face='Lucida Console'>(</font><font color='#5555FF'>*</font>xcos<font color='#5555FF'>+</font><font color='#5555FF'>+</font> <font color='#5555FF'>+</font> <font color='#5555FF'>*</font>ysin<font color='#5555FF'>+</font><font color='#5555FF'>+</font><font face='Lucida Console'>)</font><font color='#5555FF'>&gt;</font><font color='#5555FF'>&gt;</font><font color='#979000'>16</font>;
                <font color='#0000FF'><u>long</u></font> rr1 <font color='#5555FF'>=</font> <font face='Lucida Console'>(</font><font color='#5555FF'>*</font>xcos<font color='#5555FF'>+</font><font color='#5555FF'>+</font> <font color='#5555FF'>+</font> <font color='#5555FF'>*</font>ysin<font color='#5555FF'>+</font><font color='#5555FF'>+</font><font face='Lucida Console'>)</font><font color='#5555FF'>&gt;</font><font color='#5555FF'>&gt;</font><font color='#979000'>16</font>;
                <font color='#0000FF'><u>long</u></font> rr2 <font color='#5555FF'>=</font> <font face='Lucida Console'>(</font><font color='#5555FF'>*</font>xcos<font color='#5555FF'>+</font><font color='#5555FF'>+</font> <font color='#5555FF'>+</font> <font color='#5555FF'>*</font>ysin<font color='#5555FF'>+</font><font color='#5555FF'>+</font><font face='Lucida Console'>)</font><font color='#5555FF'>&gt;</font><font color='#5555FF'>&gt;</font><font color='#979000'>16</font>;
                <font color='#0000FF'><u>long</u></font> rr3 <font color='#5555FF'>=</font> <font face='Lucida Console'>(</font><font color='#5555FF'>*</font>xcos<font color='#5555FF'>+</font><font color='#5555FF'>+</font> <font color='#5555FF'>+</font> <font color='#5555FF'>*</font>ysin<font color='#5555FF'>+</font><font color='#5555FF'>+</font><font face='Lucida Console'>)</font><font color='#5555FF'>&gt;</font><font color='#5555FF'>&gt;</font><font color='#979000'>16</font>;
                <font color='#0000FF'><u>long</u></font> rr4 <font color='#5555FF'>=</font> <font face='Lucida Console'>(</font><font color='#5555FF'>*</font>xcos<font color='#5555FF'>+</font><font color='#5555FF'>+</font> <font color='#5555FF'>+</font> <font color='#5555FF'>*</font>ysin<font color='#5555FF'>+</font><font color='#5555FF'>+</font><font face='Lucida Console'>)</font><font color='#5555FF'>&gt;</font><font color='#5555FF'>&gt;</font><font color='#979000'>16</font>;
                <font color='#0000FF'><u>long</u></font> rr5 <font color='#5555FF'>=</font> <font face='Lucida Console'>(</font><font color='#5555FF'>*</font>xcos<font color='#5555FF'>+</font><font color='#5555FF'>+</font> <font color='#5555FF'>+</font> <font color='#5555FF'>*</font>ysin<font color='#5555FF'>+</font><font color='#5555FF'>+</font><font face='Lucida Console'>)</font><font color='#5555FF'>&gt;</font><font color='#5555FF'>&gt;</font><font color='#979000'>16</font>;
                <font color='#0000FF'><u>long</u></font> rr6 <font color='#5555FF'>=</font> <font face='Lucida Console'>(</font><font color='#5555FF'>*</font>xcos<font color='#5555FF'>+</font><font color='#5555FF'>+</font> <font color='#5555FF'>+</font> <font color='#5555FF'>*</font>ysin<font color='#5555FF'>+</font><font color='#5555FF'>+</font><font face='Lucida Console'>)</font><font color='#5555FF'>&gt;</font><font color='#5555FF'>&gt;</font><font color='#979000'>16</font>;
                <font color='#0000FF'><u>long</u></font> rr7 <font color='#5555FF'>=</font> <font face='Lucida Console'>(</font><font color='#5555FF'>*</font>xcos<font color='#5555FF'>+</font><font color='#5555FF'>+</font> <font color='#5555FF'>+</font> <font color='#5555FF'>*</font>ysin<font color='#5555FF'>+</font><font color='#5555FF'>+</font><font face='Lucida Console'>)</font><font color='#5555FF'>&gt;</font><font color='#5555FF'>&gt;</font><font color='#979000'>16</font>;

                <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>himg[rr0][t<font color='#5555FF'>+</font><font color='#5555FF'>+</font>] <font color='#5555FF'>&gt;</font> best_val<font face='Lucida Console'>)</font>
                <b>{</b>
                    best_val <font color='#5555FF'>=</font> himg[rr0][t<font color='#5555FF'>-</font><font color='#979000'>1</font>];
                    best_point.<font color='#BB00BB'>x</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font> t<font color='#5555FF'>-</font><font color='#979000'>1</font>;
                    best_point.<font color='#BB00BB'>y</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font> rr0;
                <b>}</b>
                <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>himg[rr1][t<font color='#5555FF'>+</font><font color='#5555FF'>+</font>] <font color='#5555FF'>&gt;</font> best_val<font face='Lucida Console'>)</font>
                <b>{</b>
                    best_val <font color='#5555FF'>=</font> himg[rr1][t<font color='#5555FF'>-</font><font color='#979000'>1</font>];
                    best_point.<font color='#BB00BB'>x</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font> t<font color='#5555FF'>-</font><font color='#979000'>1</font>;
                    best_point.<font color='#BB00BB'>y</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font> rr1;
                <b>}</b>
                <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>himg[rr2][t<font color='#5555FF'>+</font><font color='#5555FF'>+</font>] <font color='#5555FF'>&gt;</font> best_val<font face='Lucida Console'>)</font>
                <b>{</b>
                    best_val <font color='#5555FF'>=</font> himg[rr2][t<font color='#5555FF'>-</font><font color='#979000'>1</font>];
                    best_point.<font color='#BB00BB'>x</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font> t<font color='#5555FF'>-</font><font color='#979000'>1</font>;
                    best_point.<font color='#BB00BB'>y</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font> rr2;
                <b>}</b>
                <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>himg[rr3][t<font color='#5555FF'>+</font><font color='#5555FF'>+</font>] <font color='#5555FF'>&gt;</font> best_val<font face='Lucida Console'>)</font>
                <b>{</b>
                    best_val <font color='#5555FF'>=</font> himg[rr3][t<font color='#5555FF'>-</font><font color='#979000'>1</font>];
                    best_point.<font color='#BB00BB'>x</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font> t<font color='#5555FF'>-</font><font color='#979000'>1</font>;
                    best_point.<font color='#BB00BB'>y</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font> rr3;
                <b>}</b>
                <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>himg[rr4][t<font color='#5555FF'>+</font><font color='#5555FF'>+</font>] <font color='#5555FF'>&gt;</font> best_val<font face='Lucida Console'>)</font>
                <b>{</b>
                    best_val <font color='#5555FF'>=</font> himg[rr4][t<font color='#5555FF'>-</font><font color='#979000'>1</font>];
                    best_point.<font color='#BB00BB'>x</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font> t<font color='#5555FF'>-</font><font color='#979000'>1</font>;
                    best_point.<font color='#BB00BB'>y</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font> rr4;
                <b>}</b>
                <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>himg[rr5][t<font color='#5555FF'>+</font><font color='#5555FF'>+</font>] <font color='#5555FF'>&gt;</font> best_val<font face='Lucida Console'>)</font>
                <b>{</b>
                    best_val <font color='#5555FF'>=</font> himg[rr5][t<font color='#5555FF'>-</font><font color='#979000'>1</font>];
                    best_point.<font color='#BB00BB'>x</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font> t<font color='#5555FF'>-</font><font color='#979000'>1</font>;
                    best_point.<font color='#BB00BB'>y</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font> rr5;
                <b>}</b>
                <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>himg[rr6][t<font color='#5555FF'>+</font><font color='#5555FF'>+</font>] <font color='#5555FF'>&gt;</font> best_val<font face='Lucida Console'>)</font>
                <b>{</b>
                    best_val <font color='#5555FF'>=</font> himg[rr6][t<font color='#5555FF'>-</font><font color='#979000'>1</font>];
                    best_point.<font color='#BB00BB'>x</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font> t<font color='#5555FF'>-</font><font color='#979000'>1</font>;
                    best_point.<font color='#BB00BB'>y</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font> rr6;
                <b>}</b>
                <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>himg[rr7][t<font color='#5555FF'>+</font><font color='#5555FF'>+</font>] <font color='#5555FF'>&gt;</font> best_val<font face='Lucida Console'>)</font>
                <b>{</b>
                    best_val <font color='#5555FF'>=</font> himg[rr7][t<font color='#5555FF'>-</font><font color='#979000'>1</font>];
                    best_point.<font color='#BB00BB'>x</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font> t<font color='#5555FF'>-</font><font color='#979000'>1</font>;
                    best_point.<font color='#BB00BB'>y</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font> rr7;
                <b>}</b>
            <b>}</b>
            <font color='#0000FF'>while</font><font face='Lucida Console'>(</font>t <font color='#5555FF'>&lt;</font> max_n4<font face='Lucida Console'>)</font>
            <b>{</b>
                <font color='#0000FF'><u>long</u></font> rr0 <font color='#5555FF'>=</font> <font face='Lucida Console'>(</font><font color='#5555FF'>*</font>xcos<font color='#5555FF'>+</font><font color='#5555FF'>+</font> <font color='#5555FF'>+</font> <font color='#5555FF'>*</font>ysin<font color='#5555FF'>+</font><font color='#5555FF'>+</font><font face='Lucida Console'>)</font><font color='#5555FF'>&gt;</font><font color='#5555FF'>&gt;</font><font color='#979000'>16</font>;
                <font color='#0000FF'><u>long</u></font> rr1 <font color='#5555FF'>=</font> <font face='Lucida Console'>(</font><font color='#5555FF'>*</font>xcos<font color='#5555FF'>+</font><font color='#5555FF'>+</font> <font color='#5555FF'>+</font> <font color='#5555FF'>*</font>ysin<font color='#5555FF'>+</font><font color='#5555FF'>+</font><font face='Lucida Console'>)</font><font color='#5555FF'>&gt;</font><font color='#5555FF'>&gt;</font><font color='#979000'>16</font>;
                <font color='#0000FF'><u>long</u></font> rr2 <font color='#5555FF'>=</font> <font face='Lucida Console'>(</font><font color='#5555FF'>*</font>xcos<font color='#5555FF'>+</font><font color='#5555FF'>+</font> <font color='#5555FF'>+</font> <font color='#5555FF'>*</font>ysin<font color='#5555FF'>+</font><font color='#5555FF'>+</font><font face='Lucida Console'>)</font><font color='#5555FF'>&gt;</font><font color='#5555FF'>&gt;</font><font color='#979000'>16</font>;
                <font color='#0000FF'><u>long</u></font> rr3 <font color='#5555FF'>=</font> <font face='Lucida Console'>(</font><font color='#5555FF'>*</font>xcos<font color='#5555FF'>+</font><font color='#5555FF'>+</font> <font color='#5555FF'>+</font> <font color='#5555FF'>*</font>ysin<font color='#5555FF'>+</font><font color='#5555FF'>+</font><font face='Lucida Console'>)</font><font color='#5555FF'>&gt;</font><font color='#5555FF'>&gt;</font><font color='#979000'>16</font>;
                <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>himg[rr0][t<font color='#5555FF'>+</font><font color='#5555FF'>+</font>] <font color='#5555FF'>&gt;</font> best_val<font face='Lucida Console'>)</font>
                <b>{</b>
                    best_val <font color='#5555FF'>=</font> himg[rr0][t<font color='#5555FF'>-</font><font color='#979000'>1</font>];
                    best_point.<font color='#BB00BB'>x</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font> t<font color='#5555FF'>-</font><font color='#979000'>1</font>;
                    best_point.<font color='#BB00BB'>y</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font> rr0;
                <b>}</b>
                <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>himg[rr1][t<font color='#5555FF'>+</font><font color='#5555FF'>+</font>] <font color='#5555FF'>&gt;</font> best_val<font face='Lucida Console'>)</font>
                <b>{</b>
                    best_val <font color='#5555FF'>=</font> himg[rr1][t<font color='#5555FF'>-</font><font color='#979000'>1</font>];
                    best_point.<font color='#BB00BB'>x</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font> t<font color='#5555FF'>-</font><font color='#979000'>1</font>;
                    best_point.<font color='#BB00BB'>y</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font> rr1;
                <b>}</b>
                <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>himg[rr2][t<font color='#5555FF'>+</font><font color='#5555FF'>+</font>] <font color='#5555FF'>&gt;</font> best_val<font face='Lucida Console'>)</font>
                <b>{</b>
                    best_val <font color='#5555FF'>=</font> himg[rr2][t<font color='#5555FF'>-</font><font color='#979000'>1</font>];
                    best_point.<font color='#BB00BB'>x</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font> t<font color='#5555FF'>-</font><font color='#979000'>1</font>;
                    best_point.<font color='#BB00BB'>y</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font> rr2;
                <b>}</b>
                <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>himg[rr3][t<font color='#5555FF'>+</font><font color='#5555FF'>+</font>] <font color='#5555FF'>&gt;</font> best_val<font face='Lucida Console'>)</font>
                <b>{</b>
                    best_val <font color='#5555FF'>=</font> himg[rr3][t<font color='#5555FF'>-</font><font color='#979000'>1</font>];
                    best_point.<font color='#BB00BB'>x</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font> t<font color='#5555FF'>-</font><font color='#979000'>1</font>;
                    best_point.<font color='#BB00BB'>y</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font> rr3;
                <b>}</b>
            <b>}</b>
            <font color='#0000FF'>while</font><font face='Lucida Console'>(</font>t <font color='#5555FF'>&lt;</font> himg.<font color='#BB00BB'>nc</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
            <b>{</b>
                <font color='#0000FF'><u>long</u></font> rr0 <font color='#5555FF'>=</font> <font face='Lucida Console'>(</font><font color='#5555FF'>*</font>xcos<font color='#5555FF'>+</font><font color='#5555FF'>+</font> <font color='#5555FF'>+</font> <font color='#5555FF'>*</font>ysin<font color='#5555FF'>+</font><font color='#5555FF'>+</font><font face='Lucida Console'>)</font><font color='#5555FF'>&gt;</font><font color='#5555FF'>&gt;</font><font color='#979000'>16</font>;
                <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>himg[rr0][t<font color='#5555FF'>+</font><font color='#5555FF'>+</font>] <font color='#5555FF'>&gt;</font> best_val<font face='Lucida Console'>)</font>
                <b>{</b>
                    best_val <font color='#5555FF'>=</font> himg[rr0][t<font color='#5555FF'>-</font><font color='#979000'>1</font>];
                    best_point.<font color='#BB00BB'>x</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font> t<font color='#5555FF'>-</font><font color='#979000'>1</font>;
                    best_point.<font color='#BB00BB'>y</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font> rr0;
                <b>}</b>
            <b>}</b>

            <font color='#0000FF'>return</font> best_point;
        <b>}</b>

        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
            <font color='#0000FF'>typename</font> in_image_type,
            <font color='#0000FF'>typename</font> out_image_type
            <font color='#5555FF'>&gt;</font>
        <font color='#0000FF'><u>void</u></font> <b><a name='operator'></a>operator</b><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> in_image_type<font color='#5555FF'>&amp;</font> img_,
            <font color='#0000FF'>const</font> rectangle<font color='#5555FF'>&amp;</font> box,
            out_image_type<font color='#5555FF'>&amp;</font> himg_
        <font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>
        <b>{</b>
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> image_traits<font color='#5555FF'>&lt;</font>in_image_type<font color='#5555FF'>&gt;</font>::pixel_type in_pixel_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> image_traits<font color='#5555FF'>&lt;</font>out_image_type<font color='#5555FF'>&gt;</font>::pixel_type out_pixel_type;

            <font color='#BB00BB'>DLIB_CASSERT</font><font face='Lucida Console'>(</font>box.<font color='#BB00BB'>width</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#BB00BB'>size</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> box.<font color='#BB00BB'>height</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#BB00BB'>size</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>,
                "<font color='#CC0000'>\t void hough_transform::operator()</font>"
                <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>\n\t Invalid arguments given to this function.</font>"
                <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>\n\t box.width():  </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> box.<font color='#BB00BB'>width</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>
                <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>\n\t box.height(): </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> box.<font color='#BB00BB'>height</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>
                <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>\n\t size():       </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> <font color='#BB00BB'>size</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>
                <font face='Lucida Console'>)</font>;

            <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font>pixel_traits<font color='#5555FF'>&lt;</font>in_pixel_type<font color='#5555FF'>&gt;</font>::grayscale <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#979000'>true</font><font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font>pixel_traits<font color='#5555FF'>&lt;</font>out_pixel_type<font color='#5555FF'>&gt;</font>::grayscale <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#979000'>true</font><font face='Lucida Console'>)</font>;

            const_image_view<font color='#5555FF'>&lt;</font>in_image_type<font color='#5555FF'>&gt;</font> <font color='#BB00BB'>img</font><font face='Lucida Console'>(</font>img_<font face='Lucida Console'>)</font>;
            image_view<font color='#5555FF'>&lt;</font>out_image_type<font color='#5555FF'>&gt;</font> <font color='#BB00BB'>himg</font><font face='Lucida Console'>(</font>himg_<font face='Lucida Console'>)</font>;

            himg.<font color='#BB00BB'>set_size</font><font face='Lucida Console'>(</font><font color='#BB00BB'>size</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>, <font color='#BB00BB'>size</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>assign_all_pixels</font><font face='Lucida Console'>(</font>himg, <font color='#979000'>0</font><font face='Lucida Console'>)</font>;

            <font color='#0000FF'>auto</font> record_hit <font color='#5555FF'>=</font> [<font color='#5555FF'>&amp;</font>]<font face='Lucida Console'>(</font><font color='#0000FF'>const</font> point<font color='#5555FF'>&amp;</font> hough_point, <font color='#0000FF'>const</font> point<font color='#5555FF'>&amp;</font> <font color='#009900'>/*img_point*/</font>, <font color='#0000FF'>const</font> in_pixel_type<font color='#5555FF'>&amp;</font> val<font face='Lucida Console'>)</font>
            <b>{</b>
                himg[hough_point.<font color='#BB00BB'>y</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>][hough_point.<font color='#BB00BB'>x</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>] <font color='#5555FF'>+</font><font color='#5555FF'>=</font> val;
            <b>}</b>;
            <font color='#BB00BB'>perform_generic_hough_transform</font><font face='Lucida Console'>(</font>img_, box, record_hit<font face='Lucida Console'>)</font>;
        <b>}</b>

        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
            <font color='#0000FF'>typename</font> in_image_type,
            <font color='#0000FF'>typename</font> out_image_type
            <font color='#5555FF'>&gt;</font>
        <font color='#0000FF'><u>void</u></font> <b><a name='operator'></a>operator</b><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> in_image_type<font color='#5555FF'>&amp;</font> img_,
            out_image_type<font color='#5555FF'>&amp;</font> himg_
        <font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>
        <b>{</b>
            rectangle <font color='#BB00BB'>box</font><font face='Lucida Console'>(</font><font color='#979000'>0</font>,<font color='#979000'>0</font>, <font color='#BB00BB'>num_columns</font><font face='Lucida Console'>(</font>img_<font face='Lucida Console'>)</font><font color='#5555FF'>-</font><font color='#979000'>1</font>, <font color='#BB00BB'>num_rows</font><font face='Lucida Console'>(</font>img_<font face='Lucida Console'>)</font><font color='#5555FF'>-</font><font color='#979000'>1</font><font face='Lucida Console'>)</font>;
            <font face='Lucida Console'>(</font><font color='#5555FF'>*</font><font color='#0000FF'>this</font><font face='Lucida Console'>)</font><font face='Lucida Console'>(</font>img_, box, himg_<font face='Lucida Console'>)</font>;
        <b>}</b>

        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
            <font color='#0000FF'>typename</font> in_image_type
            <font color='#5555FF'>&gt;</font>
        std::vector<font color='#5555FF'>&lt;</font>std::vector<font color='#5555FF'>&lt;</font>point<font color='#5555FF'>&gt;</font><font color='#5555FF'>&gt;</font> <b><a name='find_pixels_voting_for_lines'></a>find_pixels_voting_for_lines</b> <font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> in_image_type<font color='#5555FF'>&amp;</font> img,
            <font color='#0000FF'>const</font> rectangle<font color='#5555FF'>&amp;</font> box,
            <font color='#0000FF'>const</font> std::vector<font color='#5555FF'>&lt;</font>point<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> hough_points,
            <font color='#0000FF'>const</font> <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> angle_window_size <font color='#5555FF'>=</font> <font color='#979000'>1</font>,
            <font color='#0000FF'>const</font> <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> radius_window_size <font color='#5555FF'>=</font> <font color='#979000'>1</font>
        <font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>
        <b>{</b>

            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> image_traits<font color='#5555FF'>&lt;</font>in_image_type<font color='#5555FF'>&gt;</font>::pixel_type in_pixel_type;

            <font color='#BB00BB'>DLIB_CASSERT</font><font face='Lucida Console'>(</font>angle_window_size <font color='#5555FF'>&gt;</font><font color='#5555FF'>=</font> <font color='#979000'>1</font><font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>DLIB_CASSERT</font><font face='Lucida Console'>(</font>radius_window_size <font color='#5555FF'>&gt;</font><font color='#5555FF'>=</font> <font color='#979000'>1</font><font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>DLIB_CASSERT</font><font face='Lucida Console'>(</font>box.<font color='#BB00BB'>width</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#BB00BB'>size</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> box.<font color='#BB00BB'>height</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#BB00BB'>size</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>,
                "<font color='#CC0000'>\t std::vector&lt;std::vector&lt;point&gt;&gt; hough_transform::find_pixels_voting_for_lines()</font>"
                <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>\n\t Invalid arguments given to this function.</font>"
                <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>\n\t box.width():  </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> box.<font color='#BB00BB'>width</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>
                <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>\n\t box.height(): </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> box.<font color='#BB00BB'>height</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>
                <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>\n\t size():       </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> <font color='#BB00BB'>size</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>
                <font face='Lucida Console'>)</font>;
<font color='#0000FF'>#ifdef</font> ENABLE_ASSERTS
            <font color='#0000FF'>for</font> <font face='Lucida Console'>(</font><font color='#0000FF'>auto</font><font color='#5555FF'>&amp;</font> p : hough_points<font face='Lucida Console'>)</font>
                <font color='#BB00BB'>DLIB_CASSERT</font><font face='Lucida Console'>(</font><font color='#BB00BB'>get_rect</font><font face='Lucida Console'>(</font><font color='#5555FF'>*</font><font color='#0000FF'>this</font><font face='Lucida Console'>)</font>.<font color='#BB00BB'>contains</font><font face='Lucida Console'>(</font>p<font face='Lucida Console'>)</font>, 
                    "<font color='#CC0000'>You gave a hough_points that isn't actually in the Hough space of this object.</font>"
                    <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>\n\t get_rect(*this): </font>"<font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> <font color='#BB00BB'>get_rect</font><font face='Lucida Console'>(</font><font color='#5555FF'>*</font><font color='#0000FF'>this</font><font face='Lucida Console'>)</font> 
                    <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>\n\t p: </font>"<font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> p 
                    <font face='Lucida Console'>)</font>;
<font color='#0000FF'>#endif</font>

            std::vector<font color='#5555FF'>&lt;</font>std::vector<font color='#5555FF'>&lt;</font>point<font color='#5555FF'>&gt;</font><font color='#5555FF'>&gt;</font> <font color='#BB00BB'>constituent_points</font><font face='Lucida Console'>(</font>hough_points.<font color='#BB00BB'>size</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;

            <font color='#009900'>// make a map that lets us look up in constant time if a hough point is in the
</font>            <font color='#009900'>// constituent_points output and if so where.
</font>            matrix<font color='#5555FF'>&lt;</font>uint32<font color='#5555FF'>&gt;</font> <font color='#BB00BB'>hmap</font><font face='Lucida Console'>(</font><font color='#BB00BB'>size</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>,<font color='#BB00BB'>size</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
            hmap <font color='#5555FF'>=</font> hough_points.<font color='#BB00BB'>size</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
            <font color='#0000FF'>for</font> <font face='Lucida Console'>(</font><font color='#0000FF'><u>size_t</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>0</font>; i <font color='#5555FF'>&lt;</font> hough_points.<font color='#BB00BB'>size</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i<font face='Lucida Console'>)</font>
            <b>{</b>
                rectangle area <font color='#5555FF'>=</font> <font color='#BB00BB'>centered_rect</font><font face='Lucida Console'>(</font>hough_points[i],angle_window_size,radius_window_size<font face='Lucida Console'>)</font>.<font color='#BB00BB'>intersect</font><font face='Lucida Console'>(</font><font color='#BB00BB'>get_rect</font><font face='Lucida Console'>(</font>hmap<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
                <font color='#0000FF'>for</font> <font face='Lucida Console'>(</font><font color='#0000FF'><u>long</u></font> r <font color='#5555FF'>=</font> area.<font color='#BB00BB'>top</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; r <font color='#5555FF'>&lt;</font><font color='#5555FF'>=</font> area.<font color='#BB00BB'>bottom</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>r<font face='Lucida Console'>)</font>
                <b>{</b>
                    <font color='#0000FF'>for</font> <font face='Lucida Console'>(</font><font color='#0000FF'><u>long</u></font> c <font color='#5555FF'>=</font> area.<font color='#BB00BB'>left</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; c <font color='#5555FF'>&lt;</font><font color='#5555FF'>=</font> area.<font color='#BB00BB'>right</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>c<font face='Lucida Console'>)</font>
                    <b>{</b>
                        <font color='#BB00BB'>hmap</font><font face='Lucida Console'>(</font>r,c<font face='Lucida Console'>)</font> <font color='#5555FF'>=</font> i;
                    <b>}</b>
                <b>}</b>
            <b>}</b>

            <font color='#009900'>// record that this image point voted for this Hough point
</font>            <font color='#0000FF'>auto</font> record_hit <font color='#5555FF'>=</font> [<font color='#5555FF'>&amp;</font>]<font face='Lucida Console'>(</font><font color='#0000FF'>const</font> point<font color='#5555FF'>&amp;</font> hough_point, <font color='#0000FF'>const</font> point<font color='#5555FF'>&amp;</font> img_point, in_pixel_type<font face='Lucida Console'>)</font>
            <b>{</b>
                <font color='#0000FF'>auto</font> idx <font color='#5555FF'>=</font> <font color='#BB00BB'>hmap</font><font face='Lucida Console'>(</font>hough_point.<font color='#BB00BB'>y</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>, hough_point.<font color='#BB00BB'>x</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
                <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>idx <font color='#5555FF'>&lt;</font> constituent_points.<font color='#BB00BB'>size</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
                <b>{</b>
                    <font color='#009900'>// don't add img_point if it's already in the list.
</font>                    <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>constituent_points[idx].<font color='#BB00BB'>size</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#979000'>0</font> <font color='#5555FF'>|</font><font color='#5555FF'>|</font> constituent_points[idx].<font color='#BB00BB'>back</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>!</font><font color='#5555FF'>=</font> img_point<font face='Lucida Console'>)</font>
                        constituent_points[idx].<font color='#BB00BB'>push_back</font><font face='Lucida Console'>(</font>img_point<font face='Lucida Console'>)</font>;
                <b>}</b>
            <b>}</b>;

            <font color='#BB00BB'>perform_generic_hough_transform</font><font face='Lucida Console'>(</font>img, box, record_hit<font face='Lucida Console'>)</font>;

            <font color='#0000FF'>return</font> constituent_points;
        <b>}</b>

        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
            <font color='#0000FF'>typename</font> in_image_type
            <font color='#5555FF'>&gt;</font>
        std::vector<font color='#5555FF'>&lt;</font>std::vector<font color='#5555FF'>&lt;</font>point<font color='#5555FF'>&gt;</font><font color='#5555FF'>&gt;</font> <b><a name='find_pixels_voting_for_lines'></a>find_pixels_voting_for_lines</b> <font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> in_image_type<font color='#5555FF'>&amp;</font> img,
            <font color='#0000FF'>const</font> std::vector<font color='#5555FF'>&lt;</font>point<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> hough_points,
            <font color='#0000FF'>const</font> <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> angle_window_size <font color='#5555FF'>=</font> <font color='#979000'>1</font>,
            <font color='#0000FF'>const</font> <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> radius_window_size <font color='#5555FF'>=</font> <font color='#979000'>1</font>
        <font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>
        <b>{</b>
            rectangle <font color='#BB00BB'>box</font><font face='Lucida Console'>(</font><font color='#979000'>0</font>,<font color='#979000'>0</font>, <font color='#BB00BB'>num_columns</font><font face='Lucida Console'>(</font>img<font face='Lucida Console'>)</font><font color='#5555FF'>-</font><font color='#979000'>1</font>, <font color='#BB00BB'>num_rows</font><font face='Lucida Console'>(</font>img<font face='Lucida Console'>)</font><font color='#5555FF'>-</font><font color='#979000'>1</font><font face='Lucida Console'>)</font>;
            <font color='#0000FF'>return</font> <font color='#BB00BB'>find_pixels_voting_for_lines</font><font face='Lucida Console'>(</font>img, box, hough_points, angle_window_size, radius_window_size<font face='Lucida Console'>)</font>;
        <b>}</b>

        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
            <font color='#0000FF'>typename</font> image_type,
            <font color='#0000FF'>typename</font> thresh_type
            <font color='#5555FF'>&gt;</font>
        std::vector<font color='#5555FF'>&lt;</font>point<font color='#5555FF'>&gt;</font> <b><a name='find_strong_hough_points'></a>find_strong_hough_points</b><font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> image_type<font color='#5555FF'>&amp;</font> himg_,
            <font color='#0000FF'>const</font> thresh_type hough_count_threshold,
            <font color='#0000FF'>const</font> <font color='#0000FF'><u>double</u></font> angle_nms_thresh,
            <font color='#0000FF'>const</font> <font color='#0000FF'><u>double</u></font> radius_nms_thresh
        <font face='Lucida Console'>)</font>
        <b>{</b>
            const_image_view<font color='#5555FF'>&lt;</font>image_type<font color='#5555FF'>&gt;</font> <font color='#BB00BB'>himg</font><font face='Lucida Console'>(</font>himg_<font face='Lucida Console'>)</font>;

            <font color='#BB00BB'>DLIB_CASSERT</font><font face='Lucida Console'>(</font>himg.<font color='#BB00BB'>nr</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#BB00BB'>size</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>DLIB_CASSERT</font><font face='Lucida Console'>(</font>himg.<font color='#BB00BB'>nc</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#BB00BB'>size</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>DLIB_CASSERT</font><font face='Lucida Console'>(</font>angle_nms_thresh <font color='#5555FF'>&gt;</font><font color='#5555FF'>=</font> <font color='#979000'>0</font><font face='Lucida Console'>)</font>
            <font color='#BB00BB'>DLIB_CASSERT</font><font face='Lucida Console'>(</font>radius_nms_thresh <font color='#5555FF'>&gt;</font><font color='#5555FF'>=</font> <font color='#979000'>0</font><font face='Lucida Console'>)</font>

            std::vector<font color='#5555FF'>&lt;</font>std::pair<font color='#5555FF'>&lt;</font><font color='#0000FF'><u>double</u></font>,point<font color='#5555FF'>&gt;</font><font color='#5555FF'>&gt;</font> initial_lines;
            <font color='#0000FF'>for</font> <font face='Lucida Console'>(</font><font color='#0000FF'><u>long</u></font> r <font color='#5555FF'>=</font> <font color='#979000'>0</font>; r <font color='#5555FF'>&lt;</font> himg.<font color='#BB00BB'>nr</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>r<font face='Lucida Console'>)</font>
            <b>{</b>
                <font color='#0000FF'>for</font> <font face='Lucida Console'>(</font><font color='#0000FF'><u>long</u></font> c <font color='#5555FF'>=</font> <font color='#979000'>0</font>; c <font color='#5555FF'>&lt;</font> himg.<font color='#BB00BB'>nc</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>c<font face='Lucida Console'>)</font>
                <b>{</b>
                    <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>himg[r][c] <font color='#5555FF'>&gt;</font><font color='#5555FF'>=</font> hough_count_threshold<font face='Lucida Console'>)</font>
                        initial_lines.<font color='#BB00BB'>emplace_back</font><font face='Lucida Console'>(</font>himg[r][c], <font color='#BB00BB'>point</font><font face='Lucida Console'>(</font>c,r<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
                <b>}</b>
            <b>}</b>


            std::vector<font color='#5555FF'>&lt;</font>point<font color='#5555FF'>&gt;</font> final_lines;
            std::vector<font color='#5555FF'>&lt;</font>std::pair<font color='#5555FF'>&lt;</font><font color='#0000FF'><u>double</u></font>,<font color='#0000FF'><u>double</u></font><font color='#5555FF'>&gt;</font><font color='#5555FF'>&gt;</font> final_angle_and_radius;

            <font color='#009900'>// Now do non-max suppression.  First, sort the initial_lines so the best lines come first.
</font>            std::<font color='#BB00BB'>sort</font><font face='Lucida Console'>(</font>initial_lines.<font color='#BB00BB'>rbegin</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>, initial_lines.<font color='#BB00BB'>rend</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>, 
                []<font face='Lucida Console'>(</font><font color='#0000FF'>const</font> std::pair<font color='#5555FF'>&lt;</font><font color='#0000FF'><u>double</u></font>,point<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> a, <font color='#0000FF'>const</font> std::pair<font color='#5555FF'>&lt;</font><font color='#0000FF'><u>double</u></font>,point<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> b<font face='Lucida Console'>)</font><b>{</b> <font color='#0000FF'>return</font> a.first<font color='#5555FF'>&lt;</font>b.first;<b>}</b><font face='Lucida Console'>)</font>;
            <font color='#0000FF'>for</font> <font face='Lucida Console'>(</font><font color='#0000FF'>auto</font><font color='#5555FF'>&amp;</font> r : initial_lines<font face='Lucida Console'>)</font>
            <b>{</b>
                <font color='#0000FF'><u>double</u></font> angle, radius;
                <font color='#BB00BB'>get_line_properties</font><font face='Lucida Console'>(</font>r.second, angle, radius<font face='Lucida Console'>)</font>;

                <font color='#009900'>// check if anything in final_lines is too close to r.second.  If
</font>                <font color='#009900'>// something is found then discard r.second.
</font>                <font color='#0000FF'>auto</font> too_close <font color='#5555FF'>=</font> <font color='#979000'>false</font>;
                <font color='#0000FF'>for</font> <font face='Lucida Console'>(</font><font color='#0000FF'>auto</font><font color='#5555FF'>&amp;</font> ref : final_angle_and_radius<font face='Lucida Console'>)</font>
                <b>{</b>
                    <font color='#0000FF'>auto</font><font color='#5555FF'>&amp;</font> ref_angle <font color='#5555FF'>=</font> ref.first;
                    <font color='#0000FF'>auto</font><font color='#5555FF'>&amp;</font> ref_radius <font color='#5555FF'>=</font> ref.second;

                    <font color='#009900'>// We need to check for wrap around in angle since, for instance, a
</font>                    <font color='#009900'>// line with angle and radius of 90 and 10 is the same line as one with
</font>                    <font color='#009900'>// angle -90 and radius -10.
</font>                    <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font><font face='Lucida Console'>(</font>std::<font color='#BB00BB'>abs</font><font face='Lucida Console'>(</font>ref_angle <font color='#5555FF'>-</font> angle<font face='Lucida Console'>)</font> <font color='#5555FF'>&lt;</font> angle_nms_thresh <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> std::<font color='#BB00BB'>abs</font><font face='Lucida Console'>(</font>ref_radius<font color='#5555FF'>-</font>radius<font face='Lucida Console'>)</font> <font color='#5555FF'>&lt;</font> radius_nms_thresh<font face='Lucida Console'>)</font> <font color='#5555FF'>|</font><font color='#5555FF'>|</font>
                        <font face='Lucida Console'>(</font><font color='#979000'>180</font> <font color='#5555FF'>-</font> std::<font color='#BB00BB'>abs</font><font face='Lucida Console'>(</font>ref_angle <font color='#5555FF'>-</font> angle<font face='Lucida Console'>)</font> <font color='#5555FF'>&lt;</font> angle_nms_thresh <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> std::<font color='#BB00BB'>abs</font><font face='Lucida Console'>(</font>ref_radius<font color='#5555FF'>+</font>radius<font face='Lucida Console'>)</font> <font color='#5555FF'>&lt;</font> radius_nms_thresh<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
                    <b>{</b>
                        too_close <font color='#5555FF'>=</font> <font color='#979000'>true</font>;
                        <font color='#0000FF'>break</font>;
                    <b>}</b>
                <b>}</b>

                <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font><font color='#5555FF'>!</font>too_close<font face='Lucida Console'>)</font>
                <b>{</b>
                    final_lines.<font color='#BB00BB'>emplace_back</font><font face='Lucida Console'>(</font>r.second<font face='Lucida Console'>)</font>;
                    final_angle_and_radius.<font color='#BB00BB'>emplace_back</font><font face='Lucida Console'>(</font>angle, radius<font face='Lucida Console'>)</font>;
                <b>}</b>
            <b>}</b>

            <font color='#0000FF'>return</font> final_lines;
        <b>}</b>


        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
            <font color='#0000FF'>typename</font> in_image_type,
            <font color='#0000FF'>typename</font> record_hit_function_type
            <font color='#5555FF'>&gt;</font>
        <font color='#0000FF'><u>void</u></font> <b><a name='perform_generic_hough_transform'></a>perform_generic_hough_transform</b> <font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> in_image_type<font color='#5555FF'>&amp;</font> img_,
            <font color='#0000FF'>const</font> rectangle<font color='#5555FF'>&amp;</font> box,
            record_hit_function_type record_hit
        <font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>
        <b>{</b>

            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> image_traits<font color='#5555FF'>&lt;</font>in_image_type<font color='#5555FF'>&gt;</font>::pixel_type in_pixel_type;

            <font color='#BB00BB'>DLIB_ASSERT</font><font face='Lucida Console'>(</font>box.<font color='#BB00BB'>width</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#BB00BB'>size</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> box.<font color='#BB00BB'>height</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#BB00BB'>size</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>,
                "<font color='#CC0000'>\t void hough_transform::perform_generic_hough_transform()</font>"
                <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>\n\t Invalid arguments given to this function.</font>"
                <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>\n\t box.width():  </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> box.<font color='#BB00BB'>width</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>
                <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>\n\t box.height(): </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> box.<font color='#BB00BB'>height</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>
                <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>\n\t size():       </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> <font color='#BB00BB'>size</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>
                <font face='Lucida Console'>)</font>;

            <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font>pixel_traits<font color='#5555FF'>&lt;</font>in_pixel_type<font color='#5555FF'>&gt;</font>::grayscale <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#979000'>true</font><font face='Lucida Console'>)</font>;


            const_image_view<font color='#5555FF'>&lt;</font>in_image_type<font color='#5555FF'>&gt;</font> <font color='#BB00BB'>img</font><font face='Lucida Console'>(</font>img_<font face='Lucida Console'>)</font>;


            <font color='#0000FF'>const</font> rectangle area <font color='#5555FF'>=</font> box.<font color='#BB00BB'>intersect</font><font face='Lucida Console'>(</font><font color='#BB00BB'>get_rect</font><font face='Lucida Console'>(</font>img<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;

            <font color='#0000FF'>const</font> <font color='#0000FF'><u>long</u></font> max_n8 <font color='#5555FF'>=</font> <font face='Lucida Console'>(</font><font color='#BB00BB'>size</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>/</font><font color='#979000'>8</font><font face='Lucida Console'>)</font><font color='#5555FF'>*</font><font color='#979000'>8</font>;
            <font color='#0000FF'>const</font> <font color='#0000FF'><u>long</u></font> max_n4 <font color='#5555FF'>=</font> <font face='Lucida Console'>(</font><font color='#BB00BB'>size</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>/</font><font color='#979000'>4</font><font face='Lucida Console'>)</font><font color='#5555FF'>*</font><font color='#979000'>4</font>;
            <font color='#0000FF'>for</font> <font face='Lucida Console'>(</font><font color='#0000FF'><u>long</u></font> r <font color='#5555FF'>=</font> area.<font color='#BB00BB'>top</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; r <font color='#5555FF'>&lt;</font><font color='#5555FF'>=</font> area.<font color='#BB00BB'>bottom</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>r<font face='Lucida Console'>)</font>
            <b>{</b>
                <font color='#0000FF'>const</font> int32<font color='#5555FF'>*</font> ysin_base <font color='#5555FF'>=</font> <font color='#5555FF'>&amp;</font><font color='#BB00BB'>ysin_theta</font><font face='Lucida Console'>(</font>r<font color='#5555FF'>-</font>box.<font color='#BB00BB'>top</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>,<font color='#979000'>0</font><font face='Lucida Console'>)</font>;
                <font color='#0000FF'>for</font> <font face='Lucida Console'>(</font><font color='#0000FF'><u>long</u></font> c <font color='#5555FF'>=</font> area.<font color='#BB00BB'>left</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; c <font color='#5555FF'>&lt;</font><font color='#5555FF'>=</font> area.<font color='#BB00BB'>right</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>c<font face='Lucida Console'>)</font>
                <b>{</b>
                    <font color='#0000FF'>const</font> <font color='#0000FF'>auto</font> val <font color='#5555FF'>=</font> img[r][c];
                    <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>val <font color='#5555FF'>!</font><font color='#5555FF'>=</font> <font color='#979000'>0</font><font face='Lucida Console'>)</font>
                    <b>{</b>
                        <font color='#009900'>/*
                        // The code in this comment is equivalent to the more complex but
                        // faster code below.  We keep this simple version of the Hough
                        // transform implementation here just to document what it's doing
                        // more clearly.
                        const point cent = center(box);
                        const long x = c - cent.x();
                        const long y = r - cent.y();
                        for (long t = 0; t &lt; size(); ++t)
                        {
                            double theta = t*pi/even_size;
                            double radius = (x*std::cos(theta) + y*std::sin(theta))/sqrt_2 + even_size/2 + 0.5;
                            long rr = static_cast&lt;long&gt;(radius);

                            record_hit(point(t,rr), point(c,r), val);
                        }
                        continue;
                        */</font>

                        <font color='#009900'>// Run the speed optimized version of the code in the above
</font>                        <font color='#009900'>// comment.
</font>                        <font color='#0000FF'>const</font> int32<font color='#5555FF'>*</font> ysin <font color='#5555FF'>=</font> ysin_base;
                        <font color='#0000FF'>const</font> int32<font color='#5555FF'>*</font> xcos <font color='#5555FF'>=</font> <font color='#5555FF'>&amp;</font><font color='#BB00BB'>xcos_theta</font><font face='Lucida Console'>(</font>c<font color='#5555FF'>-</font>box.<font color='#BB00BB'>left</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>,<font color='#979000'>0</font><font face='Lucida Console'>)</font>;
                        <font color='#0000FF'><u>long</u></font> t <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
                        <font color='#0000FF'>while</font><font face='Lucida Console'>(</font>t <font color='#5555FF'>&lt;</font> max_n8<font face='Lucida Console'>)</font>
                        <b>{</b>
                            <font color='#0000FF'><u>long</u></font> rr0 <font color='#5555FF'>=</font> <font face='Lucida Console'>(</font><font color='#5555FF'>*</font>xcos<font color='#5555FF'>+</font><font color='#5555FF'>+</font> <font color='#5555FF'>+</font> <font color='#5555FF'>*</font>ysin<font color='#5555FF'>+</font><font color='#5555FF'>+</font><font face='Lucida Console'>)</font><font color='#5555FF'>&gt;</font><font color='#5555FF'>&gt;</font><font color='#979000'>16</font>;
                            <font color='#0000FF'><u>long</u></font> rr1 <font color='#5555FF'>=</font> <font face='Lucida Console'>(</font><font color='#5555FF'>*</font>xcos<font color='#5555FF'>+</font><font color='#5555FF'>+</font> <font color='#5555FF'>+</font> <font color='#5555FF'>*</font>ysin<font color='#5555FF'>+</font><font color='#5555FF'>+</font><font face='Lucida Console'>)</font><font color='#5555FF'>&gt;</font><font color='#5555FF'>&gt;</font><font color='#979000'>16</font>;
                            <font color='#0000FF'><u>long</u></font> rr2 <font color='#5555FF'>=</font> <font face='Lucida Console'>(</font><font color='#5555FF'>*</font>xcos<font color='#5555FF'>+</font><font color='#5555FF'>+</font> <font color='#5555FF'>+</font> <font color='#5555FF'>*</font>ysin<font color='#5555FF'>+</font><font color='#5555FF'>+</font><font face='Lucida Console'>)</font><font color='#5555FF'>&gt;</font><font color='#5555FF'>&gt;</font><font color='#979000'>16</font>;
                            <font color='#0000FF'><u>long</u></font> rr3 <font color='#5555FF'>=</font> <font face='Lucida Console'>(</font><font color='#5555FF'>*</font>xcos<font color='#5555FF'>+</font><font color='#5555FF'>+</font> <font color='#5555FF'>+</font> <font color='#5555FF'>*</font>ysin<font color='#5555FF'>+</font><font color='#5555FF'>+</font><font face='Lucida Console'>)</font><font color='#5555FF'>&gt;</font><font color='#5555FF'>&gt;</font><font color='#979000'>16</font>;
                            <font color='#0000FF'><u>long</u></font> rr4 <font color='#5555FF'>=</font> <font face='Lucida Console'>(</font><font color='#5555FF'>*</font>xcos<font color='#5555FF'>+</font><font color='#5555FF'>+</font> <font color='#5555FF'>+</font> <font color='#5555FF'>*</font>ysin<font color='#5555FF'>+</font><font color='#5555FF'>+</font><font face='Lucida Console'>)</font><font color='#5555FF'>&gt;</font><font color='#5555FF'>&gt;</font><font color='#979000'>16</font>;
                            <font color='#0000FF'><u>long</u></font> rr5 <font color='#5555FF'>=</font> <font face='Lucida Console'>(</font><font color='#5555FF'>*</font>xcos<font color='#5555FF'>+</font><font color='#5555FF'>+</font> <font color='#5555FF'>+</font> <font color='#5555FF'>*</font>ysin<font color='#5555FF'>+</font><font color='#5555FF'>+</font><font face='Lucida Console'>)</font><font color='#5555FF'>&gt;</font><font color='#5555FF'>&gt;</font><font color='#979000'>16</font>;
                            <font color='#0000FF'><u>long</u></font> rr6 <font color='#5555FF'>=</font> <font face='Lucida Console'>(</font><font color='#5555FF'>*</font>xcos<font color='#5555FF'>+</font><font color='#5555FF'>+</font> <font color='#5555FF'>+</font> <font color='#5555FF'>*</font>ysin<font color='#5555FF'>+</font><font color='#5555FF'>+</font><font face='Lucida Console'>)</font><font color='#5555FF'>&gt;</font><font color='#5555FF'>&gt;</font><font color='#979000'>16</font>;
                            <font color='#0000FF'><u>long</u></font> rr7 <font color='#5555FF'>=</font> <font face='Lucida Console'>(</font><font color='#5555FF'>*</font>xcos<font color='#5555FF'>+</font><font color='#5555FF'>+</font> <font color='#5555FF'>+</font> <font color='#5555FF'>*</font>ysin<font color='#5555FF'>+</font><font color='#5555FF'>+</font><font face='Lucida Console'>)</font><font color='#5555FF'>&gt;</font><font color='#5555FF'>&gt;</font><font color='#979000'>16</font>;

                            <font color='#BB00BB'>record_hit</font><font face='Lucida Console'>(</font><font color='#BB00BB'>point</font><font face='Lucida Console'>(</font>t<font color='#5555FF'>+</font><font color='#5555FF'>+</font>,rr0<font face='Lucida Console'>)</font>, <font color='#BB00BB'>point</font><font face='Lucida Console'>(</font>c,r<font face='Lucida Console'>)</font>, val<font face='Lucida Console'>)</font>;
                            <font color='#BB00BB'>record_hit</font><font face='Lucida Console'>(</font><font color='#BB00BB'>point</font><font face='Lucida Console'>(</font>t<font color='#5555FF'>+</font><font color='#5555FF'>+</font>,rr1<font face='Lucida Console'>)</font>, <font color='#BB00BB'>point</font><font face='Lucida Console'>(</font>c,r<font face='Lucida Console'>)</font>, val<font face='Lucida Console'>)</font>;
                            <font color='#BB00BB'>record_hit</font><font face='Lucida Console'>(</font><font color='#BB00BB'>point</font><font face='Lucida Console'>(</font>t<font color='#5555FF'>+</font><font color='#5555FF'>+</font>,rr2<font face='Lucida Console'>)</font>, <font color='#BB00BB'>point</font><font face='Lucida Console'>(</font>c,r<font face='Lucida Console'>)</font>, val<font face='Lucida Console'>)</font>;
                            <font color='#BB00BB'>record_hit</font><font face='Lucida Console'>(</font><font color='#BB00BB'>point</font><font face='Lucida Console'>(</font>t<font color='#5555FF'>+</font><font color='#5555FF'>+</font>,rr3<font face='Lucida Console'>)</font>, <font color='#BB00BB'>point</font><font face='Lucida Console'>(</font>c,r<font face='Lucida Console'>)</font>, val<font face='Lucida Console'>)</font>;
                            <font color='#BB00BB'>record_hit</font><font face='Lucida Console'>(</font><font color='#BB00BB'>point</font><font face='Lucida Console'>(</font>t<font color='#5555FF'>+</font><font color='#5555FF'>+</font>,rr4<font face='Lucida Console'>)</font>, <font color='#BB00BB'>point</font><font face='Lucida Console'>(</font>c,r<font face='Lucida Console'>)</font>, val<font face='Lucida Console'>)</font>;
                            <font color='#BB00BB'>record_hit</font><font face='Lucida Console'>(</font><font color='#BB00BB'>point</font><font face='Lucida Console'>(</font>t<font color='#5555FF'>+</font><font color='#5555FF'>+</font>,rr5<font face='Lucida Console'>)</font>, <font color='#BB00BB'>point</font><font face='Lucida Console'>(</font>c,r<font face='Lucida Console'>)</font>, val<font face='Lucida Console'>)</font>;
                            <font color='#BB00BB'>record_hit</font><font face='Lucida Console'>(</font><font color='#BB00BB'>point</font><font face='Lucida Console'>(</font>t<font color='#5555FF'>+</font><font color='#5555FF'>+</font>,rr6<font face='Lucida Console'>)</font>, <font color='#BB00BB'>point</font><font face='Lucida Console'>(</font>c,r<font face='Lucida Console'>)</font>, val<font face='Lucida Console'>)</font>;
                            <font color='#BB00BB'>record_hit</font><font face='Lucida Console'>(</font><font color='#BB00BB'>point</font><font face='Lucida Console'>(</font>t<font color='#5555FF'>+</font><font color='#5555FF'>+</font>,rr7<font face='Lucida Console'>)</font>, <font color='#BB00BB'>point</font><font face='Lucida Console'>(</font>c,r<font face='Lucida Console'>)</font>, val<font face='Lucida Console'>)</font>;
                        <b>}</b>
                        <font color='#0000FF'>while</font><font face='Lucida Console'>(</font>t <font color='#5555FF'>&lt;</font> max_n4<font face='Lucida Console'>)</font>
                        <b>{</b>
                            <font color='#0000FF'><u>long</u></font> rr0 <font color='#5555FF'>=</font> <font face='Lucida Console'>(</font><font color='#5555FF'>*</font>xcos<font color='#5555FF'>+</font><font color='#5555FF'>+</font> <font color='#5555FF'>+</font> <font color='#5555FF'>*</font>ysin<font color='#5555FF'>+</font><font color='#5555FF'>+</font><font face='Lucida Console'>)</font><font color='#5555FF'>&gt;</font><font color='#5555FF'>&gt;</font><font color='#979000'>16</font>;
                            <font color='#0000FF'><u>long</u></font> rr1 <font color='#5555FF'>=</font> <font face='Lucida Console'>(</font><font color='#5555FF'>*</font>xcos<font color='#5555FF'>+</font><font color='#5555FF'>+</font> <font color='#5555FF'>+</font> <font color='#5555FF'>*</font>ysin<font color='#5555FF'>+</font><font color='#5555FF'>+</font><font face='Lucida Console'>)</font><font color='#5555FF'>&gt;</font><font color='#5555FF'>&gt;</font><font color='#979000'>16</font>;
                            <font color='#0000FF'><u>long</u></font> rr2 <font color='#5555FF'>=</font> <font face='Lucida Console'>(</font><font color='#5555FF'>*</font>xcos<font color='#5555FF'>+</font><font color='#5555FF'>+</font> <font color='#5555FF'>+</font> <font color='#5555FF'>*</font>ysin<font color='#5555FF'>+</font><font color='#5555FF'>+</font><font face='Lucida Console'>)</font><font color='#5555FF'>&gt;</font><font color='#5555FF'>&gt;</font><font color='#979000'>16</font>;
                            <font color='#0000FF'><u>long</u></font> rr3 <font color='#5555FF'>=</font> <font face='Lucida Console'>(</font><font color='#5555FF'>*</font>xcos<font color='#5555FF'>+</font><font color='#5555FF'>+</font> <font color='#5555FF'>+</font> <font color='#5555FF'>*</font>ysin<font color='#5555FF'>+</font><font color='#5555FF'>+</font><font face='Lucida Console'>)</font><font color='#5555FF'>&gt;</font><font color='#5555FF'>&gt;</font><font color='#979000'>16</font>;
                            <font color='#BB00BB'>record_hit</font><font face='Lucida Console'>(</font><font color='#BB00BB'>point</font><font face='Lucida Console'>(</font>t<font color='#5555FF'>+</font><font color='#5555FF'>+</font>,rr0<font face='Lucida Console'>)</font>, <font color='#BB00BB'>point</font><font face='Lucida Console'>(</font>c,r<font face='Lucida Console'>)</font>, val<font face='Lucida Console'>)</font>;
                            <font color='#BB00BB'>record_hit</font><font face='Lucida Console'>(</font><font color='#BB00BB'>point</font><font face='Lucida Console'>(</font>t<font color='#5555FF'>+</font><font color='#5555FF'>+</font>,rr1<font face='Lucida Console'>)</font>, <font color='#BB00BB'>point</font><font face='Lucida Console'>(</font>c,r<font face='Lucida Console'>)</font>, val<font face='Lucida Console'>)</font>;
                            <font color='#BB00BB'>record_hit</font><font face='Lucida Console'>(</font><font color='#BB00BB'>point</font><font face='Lucida Console'>(</font>t<font color='#5555FF'>+</font><font color='#5555FF'>+</font>,rr2<font face='Lucida Console'>)</font>, <font color='#BB00BB'>point</font><font face='Lucida Console'>(</font>c,r<font face='Lucida Console'>)</font>, val<font face='Lucida Console'>)</font>;
                            <font color='#BB00BB'>record_hit</font><font face='Lucida Console'>(</font><font color='#BB00BB'>point</font><font face='Lucida Console'>(</font>t<font color='#5555FF'>+</font><font color='#5555FF'>+</font>,rr3<font face='Lucida Console'>)</font>, <font color='#BB00BB'>point</font><font face='Lucida Console'>(</font>c,r<font face='Lucida Console'>)</font>, val<font face='Lucida Console'>)</font>;
                        <b>}</b>
                        <font color='#0000FF'>while</font><font face='Lucida Console'>(</font>t <font color='#5555FF'>&lt;</font> <font face='Lucida Console'>(</font><font color='#0000FF'><u>long</u></font><font face='Lucida Console'>)</font><font color='#BB00BB'>size</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
                        <b>{</b>
                            <font color='#0000FF'><u>long</u></font> rr0 <font color='#5555FF'>=</font> <font face='Lucida Console'>(</font><font color='#5555FF'>*</font>xcos<font color='#5555FF'>+</font><font color='#5555FF'>+</font> <font color='#5555FF'>+</font> <font color='#5555FF'>*</font>ysin<font color='#5555FF'>+</font><font color='#5555FF'>+</font><font face='Lucida Console'>)</font><font color='#5555FF'>&gt;</font><font color='#5555FF'>&gt;</font><font color='#979000'>16</font>;
                            <font color='#BB00BB'>record_hit</font><font face='Lucida Console'>(</font><font color='#BB00BB'>point</font><font face='Lucida Console'>(</font>t<font color='#5555FF'>+</font><font color='#5555FF'>+</font>,rr0<font face='Lucida Console'>)</font>, <font color='#BB00BB'>point</font><font face='Lucida Console'>(</font>c,r<font face='Lucida Console'>)</font>, val<font face='Lucida Console'>)</font>;
                        <b>}</b>
                    <b>}</b>
                <b>}</b>
            <b>}</b>
        <b>}</b>

        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
            <font color='#0000FF'>typename</font> in_image_type,
            <font color='#0000FF'>typename</font> record_hit_function_type
            <font color='#5555FF'>&gt;</font>
        <font color='#0000FF'><u>void</u></font> <b><a name='perform_generic_hough_transform'></a>perform_generic_hough_transform</b> <font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> in_image_type<font color='#5555FF'>&amp;</font> img_,
            record_hit_function_type record_hit
        <font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>
        <b>{</b>
            rectangle <font color='#BB00BB'>box</font><font face='Lucida Console'>(</font><font color='#979000'>0</font>,<font color='#979000'>0</font>, <font color='#BB00BB'>num_columns</font><font face='Lucida Console'>(</font>img_<font face='Lucida Console'>)</font><font color='#5555FF'>-</font><font color='#979000'>1</font>, <font color='#BB00BB'>num_rows</font><font face='Lucida Console'>(</font>img_<font face='Lucida Console'>)</font><font color='#5555FF'>-</font><font color='#979000'>1</font><font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>perform_generic_hough_transform</font><font face='Lucida Console'>(</font>img_, box, record_hit<font face='Lucida Console'>)</font>;
        <b>}</b>
        
    <font color='#0000FF'>private</font>:

        <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> _size;
        <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> even_size; <font color='#009900'>// equal to _size if _size is even, otherwise equal to _size-1.
</font>        matrix<font color='#5555FF'>&lt;</font>int32<font color='#5555FF'>&gt;</font> xcos_theta, ysin_theta;
    <b>}</b>;
<b>}</b>

<font color='#0000FF'>#endif</font> <font color='#009900'>// DLIB_HOUGH_tRANSFORM_Hh_
</font>

</pre></body></html>